﻿using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using StackExchange.Redis;

namespace 配置系统集成.Controllers
{
  [Route("api/[controller]/[action]")]
  [ApiController]
  public class ValuesController : ControllerBase
  {
   private readonly IOptions<SmtpSettings> _smtpSettings;
    private readonly IConnectionMultiplexer _connectionMultiplexer;
    public ValuesController(IOptions<SmtpSettings> smtpSettings, IConnectionMultiplexer connectionMultiplexer)
    {
      _smtpSettings = smtpSettings;
      _connectionMultiplexer = connectionMultiplexer;
    }

    [HttpGet]
    public string Demo1()
    {
      var ping = _connectionMultiplexer.GetDatabase(0).Ping();
      
      return _smtpSettings.Value.ToString()+"|"+ping;
    }
  }
}
